<!-- 时间指示器组件 -->
<template>
  <div 
    class="time-indicator"
    :style="{ transform: `translateX(${position}px)` }"
    @mousedown.stop="onMouseDown"
  >
    <div class="indicator-head"></div>
    <div class="indicator-line"></div>
  </div>
</template>

<script setup lang="ts">
import { defineProps, defineEmits } from 'vue'

// 定义属性
const props = defineProps({
  position: {
    type: Number,
    required: true
  },
  isDragging: {
    type: Boolean,
    default: false
  }
})

// 定义事件
const emit = defineEmits(['dragStart'])

// 鼠标按下开始拖动
const onMouseDown = (event: MouseEvent) => {
  if (event.button !== 0) return // 只处理左键点击
  emit('dragStart', event)
}
</script>

<style lang="scss" scoped>
.time-indicator {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  z-index: 100;
  pointer-events: none;
  will-change: transform;
  
  .indicator-head {
    position: absolute;
    top: 0;
    left: -7px;
    width: 14px;
    height: 14px;
    background-color: #ff3030;
    border: 2px solid #fff;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    pointer-events: auto;
    cursor: ew-resize;
    z-index: 2;
    transition: transform 0.1s ease;
    
    &:hover {
      transform: scale(1.2);
    }
  }
  
  .indicator-line {
    position: absolute;
    top: 14px;
    bottom: 0;
    left: 0;
    width: 2px;
    background-color: #ff3030;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
  }
}
</style> 